package cn.wsalix.templet.repository;
import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import cn.anlaser.repository.SimpleRepository;
import cn.wsalix.templet.entity.SitePage;

public interface SitePageRepository extends SimpleRepository<SitePage> {
	@Query("select u from SitePage u where u.siteInfo.id = :siteId")
	List<SitePage> findBySiteId(@Param("siteId") Long siteId);

	@Query("select u from SitePage u where u.menuUrl=:menuUrl and u.siteInfo.id = :siteId")
	SitePage findByUrlAndStId(@Param("menuUrl") String menuUrl,
			@Param("siteId") Long siteId);

/*	@Query("select u from SitePage u where u.menuStructure.id=:menuStruId and u.siteTemplet.id = :siteTempId")
	SitePage findByMenuIdAndStIdOne(@Param("menuStruId") Long menuStruId,
			@Param("siteTempId") Long siteTempId);*/

	/*@Query("select u from SitePage u where u.siteTemplet.id = :siteTempletId and reqUrlPattern =:urlPattern")
	SitePage findBySiIdAndUrlPatternOne(
			@Param("siteTempletId") Long siteTempletId,
			@Param("urlPattern") String urlPattern);

	@Query("select u from SitePage u where u.menuStructure.id = :menuStruId")
	SitePage findByMenuId(@Param("menuStruId") Long menuStruId);
*/
	@Query("select u from SitePage u where u.menuUrl = :menuUrl")
	SitePage findByMenuUrl(@Param("menuUrl") String menuUrl);
	
}
